<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-model="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>vue组件</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>

</head>
<body>
<div id="app">
    <czx v-for="item in items" v-bind:list="item"></czx>
</div>
</body>
<script>
    //组件无法直接获取items,所以定义一个自定义的list属性，将list属性和for循环出来的item进行绑定，通过props将自定义的list属性传递给组件
    Vue.component("czx",{
        props:['list'],
        template:'<li>{{list}}</li>'
    });
    // 实例化vue对象
    new Vue({
        el:"#app",
        data:{
            items:['php','java','vue']
        }
    });
</script>
</html>